Resumen

Row

Cantidad de proyectos

25

Total presupuestado

25

Total en ejecucion

25

Total ejecutado

25

% en ejecucion

% ejecutado

Row

Presupuestado vs Ejecutado

Row

Chart B

Chart C

Graficos

Tablas

Informe

---
title: "Inversion publica 2006-2022"
author: "Ada Cueto - Alexander Sucre"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
    source_code: embed
    theme:
      version: 4
      base_font:
        google: Sen
      code_font:
        google: JetBrains Mono
      bootswatch: darkly
---

```{r setup, include=FALSE}
rm(list = ls())
pacman::p_load(
  flexdashboard,
  tidyverse,
  sparklyr,
  readxl,
  dplyr,
  ggplot2,
  GGally,
  ggthemes,
  plotly,
  DataExplorer,
  textshape,
  reticulate,
  tictoc,
  parquetize,
  knitr,
  DT
)
sc <- spark_connect(master = "local")
proy <- spark_read_csv(sc, name = "proyecto", path = "../_data/Proyectos.csv",memory = F)
```

# Resumen 

```{r}
```

Row
-----------------------------------------------------------------------

### Cantidad de proyectos {.value-box}

```{r}
articles <- 25
valueBox(articles, icon = "fa-pencil")
```

### Total presupuestado {.value-box}

```{r}
articles <- 25
valueBox(articles, icon = "fa-pencil")
```

### Total en ejecucion {.value-box}

```{r}
articles <- 25
valueBox(articles, icon = "fa-pencil")
```

### Total ejecutado {.value-box}

```{r}
articles <- 25
valueBox(articles, icon = "fa-pencil")
```

### % en ejecucion 

```{r}
articles <- 25
gauge(articles, min = 0, max = 100, symbol = "%",
      gaugeSectors(
        warning = c(0,articles)
      ))
```

### % ejecutado 

```{r}
articles <- 66
gauge(articles, min = 0, max = 100, symbol = "%",
      gaugeSectors(
        success = c(0,articles)
      ))
```

Row
-----------------------------------------------------------------------

### Presupuestado vs Ejecutado

```{r}
gest <- proy %>% 
  select(gestion,inicial=Presupuesto_inicial,ejecutado=presupuesto_ejecutado) %>% 
  group_by(gestion) %>% 
  summarise(inicial=sum(inicial),ejecutado=sum(ejecutado)) %>% 
  arrange(gestion)
gest <- collect(gest)

fig <- plot_ly(gest, x = ~gestion, y = ~inicial, type = 'scatter', mode = 'lines', fill = 'tozeroy', name = 'Presupuesto programado')
fig <- fig %>% add_trace(y = ~ejecutado, name = 'Presupuesto ejecutado')

fig <- fig %>% layout(
  xaxis = list(title = 'Gestión'),
  yaxis = list(title = 'Monto en millones de dolares'),
  title = 'Comparación de presupuesto inicial y ejecutado por gestión'
)

fig
```

Row
-----------------------------------------------------------------------

### Chart B

```{r}
dep <- proy %>% count(depto) %>% rename(Departamento=depto,Cantidad=n)
dep_local <- collect(dep)
datatable(dep_local,options = list(paging=FALSE,searching=FALSE,info=FALSE))
```

### Chart C

```{r}
dep <- proy %>% count(depto) %>% mutate(porcentaje = n/sum(n)*100) %>% select(Departamento=depto,Porcentaje=porcentaje)
dep_local <- collect(dep)
plot_ly(dep_local,labels=~Departamento,values=~Porcentaje,type = "pie") %>% 
  layout(title="Proyectos por departamento",
         xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
         yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
```

# Graficos {data-navmenu="Analisis" data-icon="fa-signal"}

## Sidebar {.sidebar}

# Tablas {data-navmenu="Analisis" data-icon="fa-list"}
```{r}
datatable(iris)
```



# Informe